<div class="es-piece" style="margin-bottom:0">
  <div class="piece-header">
    {{ 'student.report_card.title'|trans }}
  </div>
  {% if finishedHomeworksCount or finishedTestpapersCount %}
  <div class="report-card">
    <div class="report-card-header">
      <i class="es-icon es-icon-chevronright mrs"></i>
      <span class="include">  {{ 'student.report_card.homework'|trans }}:{{ finishedHomeworksCount }}/{{ homeworksCount }}&nbsp;&nbsp;&nbsp;{{ 'student.report_card.testpaper'|trans}}:{{ finishedTestpapersCount }}
        /{{ testpapersCount }}</span>
    </div>
    {% for activity in activities if activity.data|default(null) %}
      {% set assessment = assessments[activity.mediaId] %}
      {% set typeName = activity.mediaType == 'homework' ? 'student.report_card.homework'|trans : 'student.report_card.testpaper'|trans %}
    {% if activity.data.finished %}
    <div class="report-card-main">
      <div class="card-main-title open"><i class="es-icon es-icon-exam mrs"></i>
        {{ typeName }}：{{ activity.name }}
        <span class="score hidden-xs">
          {% if activity.mediaType == 'homework' %}
            <span>{{ dict_text('passedStatus', activity.data.bestRecord.grade) }}</span>
          {% else %}
            <span>{{ activity.data.bestRecord.score|default(0) }}</span>
            {{ 'site.data.score'|trans }} / {{ assessment.total_score|default(0) }}{{ 'site.data.score'|trans }}
          {% endif %}
        </span>
      </div>
      <ul class="score-list">
        {% for record in activity.data.finished %}
          <li>
            <span class="name">
              {{ 'student.report_card.loop_index'|trans({'%loopIndex%':loop.index, '%typeName%':typeName}) }}
            </span>
            <span class="date">
              {{ record.begin_time|date('Y/m/d') }}
            </span>
            <span class="score">
              {% if activity.mediaType == 'homework' %}
                {{ dict_text('passedStatus', record.grade) }}
              {% else %}
                {{ record.score }}
              {% endif %}
            </span>
            <span class="hidden-xs pull-right" data-toggle="tooltip" data-placement="top"
              title="{% if record.comment|default('') %}{{ record.comment }}{% else %}{{ 'student.report_card.teacherSay.empty'|trans }}{% endif %}">{{ 'student.report_card.teacherSay'|trans }}</span>
          </li>
        {% endfor %}
        {% if activity.data.reviewing %}
          {% for result in activity.data.reviewing %}
            <li>
              <span class="name">{{ 'student.report_card.loop_index'|trans({'%loopIndex%':loop.index, '%typeName%':typeName}) }}</span>
              <span class="date">{{ result.begin_time|date('Y/m/d') }}</span>
              <span class="score">{{ 'student.report_card.review'|trans }}</span>
            </li>
          {% endfor %}
        {% endif %}
      </ul>
    </div>
  {% elseif activity.data.reviewing %}
    <div class="report-card-main">
      <div class="card-main-title open"><i class="es-icon es-icon-exam mrs"></i>
        {{ typeName }}：{{ activity.name }}
        <span class="score hidden-xs">{{ 'student.report_card.review'|trans }}</span>
      </div>
      <ul class="score-list">
        {% for record in activity.data.reviewing %}
          <li>
            <span class="name">{{ 'student.report_card.loop_index'|trans({'%loopIndex%':loop.index, '%typeName%':typeName}) }}</span>
            <span class="date">{{ record.begin_time|date('Y/m/d') }}</span>
            <span class="score">{{ 'student.report_card.review'|trans }}</span>
          </li>
        {% endfor %}
      </ul>
      {% endif %}
      {% endfor %}
    </div>
    {% else %}
      <div class="empty">
        {{ 'student.report_card.empty'|trans }}
      </div>
    {% endif %}
  </div>
